Imports System.Text
Imports System.ComponentModel
Imports System.Threading
Imports System.Runtime.InteropServices

' Interface with Driver

<TypeConverter(GetType(WevTestConverter))>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1)>
Public Class WevTest_T

    Public Property State As Byte
    
End Class

<TypeConverter(GetType(WevCurrentConverter))>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1)>
Public Class WevCurrent_T

    Public Property Ib As Single
    Public Property Ic As Single
    Public Property Id As Single
    Public Property Iq As Single
    Public Property ActualTorque As Single
    
End Class

<TypeConverter(GetType(WevEncoderConverter))>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1)>
Public Class WevEncoder_T

    Public Property Radians As Single
    Public Property RadianOffset As Single
    Public Property ActualPos As Single
    Public Property Counts As Integer
    Public Property ActualRpm As Single
    Public Property RpmFiltered As Single
    Public Property Warning As Byte
    Public Property Errorno As Byte

End Class

<TypeConverter(GetType(WevPidConverter))>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1)>
Public Class WevPid_T

    Public Property VelKp As Single
    Public Property VelKi As Single
    Public Property PosKp As Single
    Public Property PosKi As Single
    
End Class

<TypeConverter(GetType(ExpandableObjectConverter))>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1)>
Public Class WevHeartBeatSlave_T

    Public ReadOnly Property Count As UShort
    Public ReadOnly Property FeedForwardRatio As Single
    Public ReadOnly Property VbusVoltage As Single
    Public ReadOnly Property VelSetpoint As Single
    Public ReadOnly Property DriverError As UInteger
    <TypeConverter(GetType(WevCurrentConverter))>
    Public Property Current As WevCurrent_T = New WevCurrent_T()
    <TypeConverter(GetType(WevEncoderConverter))>
    Public Property Encoder As WevEncoder_T = New WevEncoder_T()
    <TypeConverter(GetType(WevPidConverter))>
    Public Property Pids As WevPid_T = New WevPid_T()
    
End Class

<TypeConverter(GetType(WevHeartBeatMasterConverter))>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1)>
Public Class WevHeartBeatMaster_T

    Public Property Count As UShort
    Public Property Enable As Byte
    Public Property EnableSetting As Byte
    Public Property Reset As Byte
    Public Property Mode As Byte
    Public Property AutoPid As Byte
    Public Property SetPids As Byte
    Public Property FeedForwardRatio As Single
    Public Property VelSetpoint As Short
    Public Property PosSetpoint As Single
    <TypeConverter(GetType(WevPidConverter))>
    Public Property Pids As WevPid_T = New WevPid_T()
    
End Class

<TypeConverter(GetType(WevAxisConverter))>
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Auto, Pack:=1)>
Public Class WevAxis_T

    Public Property VbusVoltage As Single
    Public Property EndstopState As Byte
    Public Property Offset As Single
    Public Property IsActiveHigh As Byte
    Public Property Pullup As Byte
    <TypeConverter(GetType(WevTestConverter))>
    Public Property Test As WevTest_T = New WevTest_T()
    
End Class
